//
//  GiftChooserViewController.swift
//  Link
//
//  Created by melvyn on 2018/8/9.
//  Copyright © 2018年 NEET. All rights reserved.
//

import UIKit
import Starscream

class GiftChooserViewController: UIViewController {
    
    var socket: WebSocket!
    var room: Live!
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func dismiss(_ sender: UITapGestureRecognizer) {
        guard sender.state == .ended else {
            return
        }
        presentingViewController?.dismiss(animated: true, completion: nil)
    }
    
    @IBAction func giftButtonPressed(_ sender: UIButton) {
        
        guard socket.isConnected else { print("socket disconnected with url: \(socketURL.absoluteString)"); return }
  
        let dictionaryValue: [String : Any] = [
            "roomKey": room.key,
//            "senderId": user.id,
            "giftId": sender.tag,
            "giftCount": 1
            ] 
        
//        socket.write(string: json, completion: <#T##(() -> ())?##(() -> ())?##() -> ()#>)
//        socket.emit("gift", )
    }
    
    override var preferredStatusBarStyle : UIStatusBarStyle {
        return .lightContent
    }
}
